import 'package:flutter_emoji/flutter_emoji.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {

  test("emojiTest", () async {
    var codepoint = int.parse("1f450", radix: 16);
    var codepoint2 = int.parse("1f3fd", radix: 16);
    print("codepoint: $codepoint");
    String unicodeString = String.fromCharCode(codepoint);
    String unicodeString2 = String.fromCharCode(codepoint2);
    print("\u{2696}asfda大法师");

    String emojiStr = "#{2696}adfa#{1f450-1f3fd}";
    String reg = r"#{(.+?)}";
    RegExp regExp = RegExp(reg);
    Iterable<RegExpMatch> iterable = regExp.allMatches(emojiStr);
    for (var i in iterable) {
      print(i.group(0));
    }
    final newString = emojiStr.replaceAllMapped(RegExp(reg), (match) {
      String? group = match.group(0);
      if (group != null) {
        return r"\u{" + group.substring(2, group.length-1) + "}";
      }
      return '';
    });
    print("newString: $newString");
  });

  test("emojiTest2", () async {
    var parser = EmojiParser();
    String emojiStr = "🥰, 😍, 😘, 😚, 😙, 🤗, 😻, 😽, 💋, 💌, 💘, 💝, 💖, 💗, 💓, 💞, 💕, ..., 💄, ";
    List<String> strs = parser.parseEmojis(emojiStr);
    for (var e in strs) {
      int index = emojiStr.indexOf(e);
      var emoni = parser.getEmoji(e);
      print("$index , $e, ${emoni.name}");
    }


  });

  test("emoji all", () async {
    var parser = EmojiParser();
    var emoji = parser.getName('coffee');
    print('emoji: ${emoji.code}');
  });

  test('emoji check', () async {
    int total = 0;
    int errorTotal = 0;
    String ss = "grinning,grin,joy,rofl,smiley,smile,sweat_smile,laughing,wink,blush,yum,sunglasses,heart_eyes,kissing_heart,kissing,kissing_smiling_eyes,kissing_closed_eyes,relaxed,slight_smile,hugging,thinking,neutral_face,expressionless,no_mouth,rolling_eyes,smirk,persevere,disappointed_relieved,open_mouth,zipper_mouth,hushed,sleepy,tired_face,sleeping,relieved,nerd,stuck_out_tongue,stuck_out_tongue_winking_eye,stuck_out_tongue_closed_eyes,drooling_face,unamused,sweat,pensive,confused,upside_down,money_mouth,astonished,frowning2,slight_frown,confounded,disappointed,worried,triumph,cry,sob,frowning,anguished,fearful,weary,grimacing,cold_sweat,scream,flushed,dizzy_face,rage,angry,innocent,cowboy,clown,lying_face,mask,thermometer_face,head_bandage,nauseated_face,sneezing_face,smiling_imp,imp,japanese_ogre,japanese_goblin,skull,ghost,alien,robot,poop,smiley_cat,smile_cat,joy_cat,heart_eyes_cat,smirk_cat,kissing_cat,scream_cat,crying_cat_face,pouting_cat,boy,girl,man,woman,older_man,older_woman,baby,angel,cop,spy,guardsman,construction_worker,man_with_turban,person_with_blond_hair,santa,mrs_claus,princess,prince,bride_with_veil,man_in_tuxedo,pregnant_woman,man_with_gua_pi_mao,person_frowning,person_with_pouting_face,no_good,ok_woman,information_desk_person,raising_hand,bow,face_palm,shrug,massage,haircut,walking,runner,dancer,man_dancing,dancers,speaking_head,bust_in_silhouette,busts_in_silhouette,couple,two_men_holding_hands,two_women_holding_hands,couplekiss,kiss_mm,kiss_ww,couple_with_heart,couple_mm,couple_ww,family,family_mwg,family_mwgb,family_mwbb,family_mwgg,family_mmb,family_mmg,family_mmgb,family_mmbb,family_mmgg,family_wwb,family_wwg,family_wwgb,family_wwbb,family_wwgg,muscle,selfie,point_left,point_right,point_up,point_up_2,middle_finger,point_down,v,fingers_crossed,vulcan,metal,call_me,hand_splayed,raised_hand,ok_hand,thumbsup,thumbsdown,fist,punch,left_facing_fist,right_facing_fist,raised_back_of_hand,wave,clap,writing_hand,open_hands,raised_hands,pray,handshake,nail_care,ear,nose,footprints,eyes,eye,tongue,lips,kiss,zzz,eyeglasses,dark_sunglasses,necktie,shirt,jeans,dress,kimono,bikini,womans_clothes,purse,handbag,pouch,school_satchel,mans_shoe,athletic_shoe,high_heel,sandal,boot,crown,womans_hat,tophat,mortar_board,helmet_with_cross,lipstick,ring,closed_umbrella,briefcase,see_no_evil,hear_no_evil,speak_no_evil,sweat_drops,dash,monkey_face,monkey,gorilla,dog,dog2,poodle,wolf,fox,cat,cat2,lion_face,tiger,tiger2,leopard,horse,racehorse,deer,unicorn,cow,ox,water_buffalo,cow2,pig,pig2,boar,pig_nose,ram,sheep,goat,dromedary_camel,camel,elephant,rhino,mouse,mouse2,rat,hamster,rabbit,rabbit2,chipmunk,bat,bear,koala,panda_face,feet,turkey,chicken,rooster,hatching_chick,baby_chick,hatched_chick,bird,penguin,dove,eagle,duck,owl,frog,crocodile,turtle,lizard,snake,dragon_face,dragon,whale,whale2,dolphin,fish,tropical_fish,blowfish,shark,octopus,shell,crab,shrimp,squid,butterfly,snail,bug,ant,bee,beetle,spider,spider_web,scorpion,bouquet,cherry_blossom,rosette,rose,wilted_rose,hibiscus,sunflower,blossom,tulip,seedling,evergreen_tree,deciduous_tree,palm_tree,cactus,ear_of_rice,herb,shamrock,four_leaf_clover,maple_leaf,fallen_leaf,leaves,mushroom,chestnut,earth_africa,earth_americas,earth_asia,new_moon,waxing_crescent_moon,first_quarter_moon,waxing_gibbous_moon,full_moon,waning_gibbous_moon,last_quarter_moon,waning_crescent_moon,crescent_moon,new_moon_with_face,first_quarter_moon_with_face,last_quarter_moon_with_face,sunny,full_moon_with_face,sun_with_face,star,star2,cloud,partly_sunny,thunder_cloud_rain,white_sun_small_cloud,white_sun_cloud,white_sun_rain_cloud,cloud_rain,cloud_snow,cloud_lightning,cloud_tornado,fog,wind_blowing_face,umbrella2,umbrella,zap,snowflake,snowman2,snowman,comet,fire,droplet,ocean,jack_o_lantern,christmas_tree,sparkles,tanabata_tree,bamboo,grapes,melon,watermelon,tangerine,lemon,banana,pineapple,apple,green_apple,pear,peach,cherries,strawberry,kiwi,tomato,avocado,eggplant,potato,carrot,corn,hot_pepper,cucumber,peanuts,bread,croissant,french_bread,pancakes,cheese,meat_on_bone,poultry_leg,bacon,hamburger,fries,pizza,hotdog,taco,burrito,stuffed_flatbread,egg,cooking,shallow_pan_of_food,stew,salad,popcorn,bento,rice_cracker,rice_ball,rice,curry,ramen,spaghetti,sweet_potato,oden,sushi,fried_shrimp,fish_cake,dango,icecream,shaved_ice,ice_cream,doughnut,cookie,birthday,cake,chocolate_bar,candy,lollipop,custard,honey_pot,baby_bottle,milk,coffee,tea,sake,champagne,wine_glass,cocktail,tropical_drink,beer,beers,champagne_glass,tumbler_glass,fork_knife_plate,fork_and_knife,spoon,space_invader,levitate,fencer,horse_racing,skier,snowboarder,golfer,surfer,rowboat,swimmer,basketball_player,lifter,bicyclist,mountain_bicyclist,cartwheel,wrestlers,water_polo,handball,juggling,circus_tent,performing_arts,art,slot_machine,bath,reminder_ribbon,tickets,ticket,military_medal,trophy,medal,first_place,second_place,third_place,soccer,baseball,basketball,volleyball,football,rugby_football,tennis,8ball,bowling,cricket,field_hockey,hockey,ping_pong,badminton,boxing_glove,martial_arts_uniform,goal,dart,golf,ice_skate,fishing_pole_and_fish,running_shirt_with_sash,ski,video_game,game_die,musical_score,microphone,headphones,saxophone,guitar,musical_keyboard,trumpet,violin,drum,clapper,bow_and_arrow,race_car,motorcycle,japan,mountain_snow,mountain,volcano,mount_fuji,camping,beach,desert,island,park,stadium,classical_building,construction_site,homes,cityscape,house_abandoned,house,house_with_garden,office,post_office,european_post_office,hospital,bank,hotel,love_hotel,convenience_store,school,department_store,factory,japanese_castle,european_castle,wedding,tokyo_tower,statue_of_liberty,church,mosque,synagogue,shinto_shrine,kaaba,fountain,tent,foggy,night_with_stars,sunrise_over_mountains,sunrise,city_dusk,city_sunset,bridge_at_night,milky_way,carousel_horse,ferris_wheel,roller_coaster,steam_locomotive,railway_car,bullettrain_side,bullettrain_front,train2,metro,light_rail,station,tram,monorail,mountain_railway,train,bus,oncoming_bus,trolleybus,minibus,ambulance,fire_engine,police_car,oncoming_police_car,taxi,oncoming_taxi,red_car,oncoming_automobile,blue_car,truck,articulated_lorry,tractor,bike,scooter,motor_scooter,busstop,motorway,railway_track,fuelpump,rotating_light,traffic_light,vertical_traffic_light,construction,anchor,sailboat,canoe,speedboat,cruise_ship,ferry,motorboat,ship,airplane,airplane_small,airplane_departure,airplane_arriving,seat,helicopter,suspension_railway,mountain_cableway,aerial_tramway,rocket,satellite_orbital,stars,rainbow,fireworks,sparkler,rice_scene,checkered_flag,skull_crossbones,love_letter,bomb,hole,shopping_bags,prayer_beads,gem,knife,amphora,map,barber,frame_photo,bellhop,door,sleeping_accommodation,bed,couch,toilet,shower,bathtub,hourglass,hourglass_flowing_sand,watch,alarm_clock,stopwatch,timer,clock,thermometer,beach_umbrella,balloon,tada,confetti_ball,dolls,flags,wind_chime,ribbon,gift,joystick,postal_horn,microphone2,level_slider,control_knobs,radio,iphone,calling,telephone,telephone_receiver,pager,fax,battery,electric_plug,computer,desktop,printer,keyboard,mouse_three_button,trackball,minidisc,floppy_disk,cd,dvd,movie_camera,film_frames,projector,tv,camera,camera_with_flash,video_camera,vhs,mag,mag_right,microscope,telescope,satellite,candle,bulb,flashlight,izakaya_lantern,notebook_with_decorative_cover,closed_book,book,green_book,blue_book,orange_book,books,notebook,ledger,page_with_curl,scroll,page_facing_up,newspaper,newspaper2,bookmark_tabs,bookmark,label,moneybag,yen,dollar,euro,pound,money_with_wings,credit_card,envelope,e-mail,incoming_envelope,envelope_with_arrow,outbox_tray,inbox_tray,package,mailbox,mailbox_closed,mailbox_with_mail,mailbox_with_no_mail,postbox,ballot_box,pencil2,black_nib,pen_fountain,pen_ballpoint,paintbrush,crayon,pencil,file_folder,open_file_folder,dividers,date,calendar,notepad_spiral,calendar_spiral,card_index,chart_with_upwards_trend,chart_with_downwards_trend,bar_chart,clipboard,pushpin,round_pushpin,paperclip,paperclips,straight_ruler,triangular_ruler,scissors,card_box,file_cabinet,wastebasket,lock,unlock,lock_with_ink_pen,closed_lock_with_key,key,key2,hammer,pick,hammer_pick,tools,dagger,crossed_swords,gun,shield,wrench,nut_and_bolt,gear,compression,alembic,scales,link,chains,syringe,pill,smoking,coffin,urn,moyai,oil,crystal_ball,shopping_cart,triangular_flag_on_post,crossed_flags,flag_black,flag_white,rainbow_flag,eye_in_speech_bubble,cupid,heart,heartbeat,broken_heart,two_hearts,sparkling_heart,heartpulse,blue_heart,green_heart,yellow_heart,purple_heart,black_heart,gift_heart,revolving_hearts,heart_decoration,heart_exclamation,anger,boom,dizzy,speech_balloon,speech_left,anger_right,thought_balloon,white_flower,globe_with_meridians,hotsprings,octagonal_sign,clock12,clock1230,clock1,clock130,clock2,clock230,clock3,clock330,clock4,clock430,clock5,clock530,clock6,clock630,clock7,clock730,clock8,clock830,clock9,clock930,clock10,clock1030,clock11,clock1130,cyclone,spades,hearts,diamonds,clubs,black_joker,mahjong,flower_playing_cards,mute,speaker,sound,loud_sound,loudspeaker,mega,bell,no_bell,musical_note,notes,chart,currency_exchange,heavy_dollar_sign,atm,put_litter_in_its_place,potable_water,wheelchair,mens,womens,restroom,baby_symbol,wc,passport_control,customs,baggage_claim,left_luggage,warning,children_crossing,no_entry,no_entry_sign,no_bicycles,no_smoking,do_not_litter,non-potable_water,no_pedestrians,no_mobile_phones,underage,radioactive,biohazard,arrow_up,arrow_upper_right,arrow_right,arrow_lower_right,arrow_down,arrow_lower_left,arrow_left,arrow_upper_left,arrow_up_down,left_right_arrow,leftwards_arrow_with_hook,arrow_right_hook,arrow_heading_up,arrow_heading_down,arrows_clockwise,arrows_counterclockwise,back,end,on,soon,top,place_of_worship,atom,om_symbol,star_of_david,wheel_of_dharma,yin_yang,cross,orthodox_cross,star_and_crescent,peace,menorah,six_pointed_star,aries,taurus,gemini,cancer,leo,virgo,libra,scorpius,sagittarius,capricorn,aquarius,pisces,ophiuchus,twisted_rightwards_arrows,repeat,repeat_one,arrow_forward,fast_forward,track_next,play_pause,arrow_backward,rewind,track_previous,arrow_up_small,arrow_double_up,arrow_down_small,arrow_double_down,pause_button,stop_button,record_button,eject,cinema,low_brightness,high_brightness,signal_strength,vibration_mode,mobile_phone_off,recycle,name_badge,fleur-de-lis,beginner,trident,o,white_check_mark,ballot_box_with_check,heavy_check_mark,heavy_multiplication_x,x,negative_squared_cross_mark,heavy_plus_sign,heavy_minus_sign,heavy_division_sign,curly_loop,loop,part_alternation_mark,eight_spoked_asterisk,eight_pointed_black_star,sparkle,bangbang,interrobang,question,grey_question,grey_exclamation,exclamation,wavy_dash,copyright,registered,tm,hash,asterisk,zero,one,two,three,four,five,six,seven,eight,nine,keycap_ten,100,capital_abcd,abcd,1234,symbols,abc,a,ab,b,cl,cool,free,information_source,id,m,new,ng,o2,ok,parking,sos,up,vs,koko,sa,u6708,u6709,u6307,ideograph_advantage,u5272,u7121,u7981,accept,u7533,u5408,u7a7a,congratulations,secret,u55b6,u6e80,black_small_square,white_small_square,white_medium_square,black_medium_square,white_medium_small_square,black_medium_small_square,black_large_square,white_large_square,large_orange_diamond,large_blue_diamond,small_orange_diamond,small_blue_diamond,small_red_triangle,small_red_triangle_down,diamond_shape_with_a_dot_inside,radio_button,black_square_button,white_square_button,white_circle,black_circle,red_circle,blue_circle";
    List<String> strList = ss.split(",");
    print("emoji total $total, error total $errorTotal");
  });
}